package team.seekers.catering.common.enums;

import com.baomidou.mybatisplus.core.enums.IEnum;
import lombok.Getter;

import java.util.Arrays;

@Getter
public enum PaymentTypeEnum implements IEnum<Integer> {
    NO_PAY(5,  "免单"),
    BACK_MONEY(4,  "退款"),
    OUT_MONEY(3,  "提现"),
    IN_MONEY(2,  "充值"),
    ORDER_IN(1, "订单收款（面向派送员）"),
    ORDER_OUT(0, "订单支付");

    private int type;

    private String name;

    PaymentTypeEnum(int type, String name) {
        this.type = type;
        this.name = name;
    }

    @Override
    public Integer getValue() {
        return this.type;
    }

    public static PaymentTypeEnum getByType(int type) {
        return Arrays.stream(values()).filter(e -> e.getType() == type).findFirst().orElse(null);
    }
}
